package org.biubiu0002.baiblog.core.api;

import com.google.common.base.Preconditions;
import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.config.annotation.DubboService;
import org.biubiu0002.baiblog.core.dto.UserInfoDto;
import org.biubiu0002.baiblog.core.model.vo.UserInfoVo;
import org.biubiu0002.baiblog.core.service.SysUserService;
import org.springframework.beans.BeanUtils;

import javax.annotation.Resource;

/**
 * @Author: biubiu0002
 * @Date: 2022/11/22 15:34
 **/
@DubboService
public class UserApiServiceImpl implements UserApiService{

    @Resource
    private SysUserService sysUserService;

    @Override
    public UserInfoDto getUserInfoByUid(String uid) {
        Preconditions.checkArgument(StringUtils.isNotBlank(uid),"用户uid不能为空");
        UserInfoVo userInfoByUserUid = sysUserService.getUserInfoByUserUid(uid);
        UserInfoDto userInfoDto = new UserInfoDto();
        BeanUtils.copyProperties(userInfoByUserUid,userInfoDto);
        return userInfoDto;
    }
}
